/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/


import { Descriptions, Image } from 'antd';
import IAutoPage from '@/components/soa/IAutoPage';
import React from 'react';
import { useRequest } from 'ahooks';
import { getSceneCommunityDetails } from '@/services/soa/sceneCommunity';
import styles from './index.less';
import {get01Text, getDateTime} from '@/utils/soa/utils';

const Index = ({ location }:any) => {
  const { query } = location;
  const sceneCommunityDetails = useRequest(getSceneCommunityDetails, {
    defaultParams: [query.sceneRecordUuid],
  });
  return (
    <IAutoPage>
      <Descriptions
        column={1}
        title={'查看详情'}
        style={{ marginLeft: 26 }}
        contentStyle={{whiteSpace: 'normal'}}
      >
        <Descriptions.Item label={'版本号'}>
          {sceneCommunityDetails?.data?.data?.version}
        </Descriptions.Item>
        <Descriptions.Item label={'场景名'}>
          {sceneCommunityDetails?.data?.data?.name}
        </Descriptions.Item>
        <Descriptions.Item label={'场景简介'} className={styles.description}>
          {sceneCommunityDetails?.data?.data?.description}
        </Descriptions.Item>
        <Descriptions.Item label={'品牌'}>
          {sceneCommunityDetails?.data?.data?.brandName}
        </Descriptions.Item>
        <Descriptions.Item label={'车系'}>
          {sceneCommunityDetails?.data?.data?.seriesName}
        </Descriptions.Item>
        <Descriptions.Item label={'车型'}>
          {sceneCommunityDetails?.data?.data?.modelName}
        </Descriptions.Item>
        <Descriptions.Item label={'场景分类'}>
          {sceneCommunityDetails?.data?.data?.categoryName}
        </Descriptions.Item>
        <Descriptions.Item label={'是否最新场景'}>
          {get01Text(sceneCommunityDetails?.data?.data?.latestScene)}
        </Descriptions.Item>
        <Descriptions.Item label={'是否官方场景'}>
          {get01Text(sceneCommunityDetails?.data?.data?.hotScene)}
        </Descriptions.Item>
        <Descriptions.Item label={'是否热门场景'}>
          {get01Text(sceneCommunityDetails?.data?.data?.officialScene)}
        </Descriptions.Item>
        <Descriptions.Item label={'手机端可执行'}>
          {get01Text(sceneCommunityDetails?.data?.data?.executedOnPhone)}
        </Descriptions.Item>
        {
          sceneCommunityDetails?.data?.data?.haveStartTrigger === 1 &&(
            <Descriptions.Item label={'车机端二次确认'}>
              {get01Text(sceneCommunityDetails?.data?.data?.doubleCheckOnVehicle)}
            </Descriptions.Item>
          )
        }
        <Descriptions.Item label={'场景图标'}>
          <Image
            style={{
              objectFit: 'contain',
              width: 60,
              height: 60,
              borderRadius: '5px',
            }}
            preview={false}
            src={sceneCommunityDetails?.data?.data?.iconUrl}
          />
        </Descriptions.Item>
        <Descriptions.Item label={'场景背景'}>
          <Image
            style={{
              objectFit: 'contain',
              width: 286,
              height: 156,
              borderRadius: '5px',
            }}
            preview={false}
            src={sceneCommunityDetails?.data?.data?.backgroundPicUrl}
          />
        </Descriptions.Item>
      </Descriptions>
      <div className={styles.publisherInfo}>发布者信息</div>
      <Descriptions column={1} style={{ marginTop: 26, marginLeft: 26 }}>
        <Descriptions.Item label={'申请时间'}>
          {getDateTime(sceneCommunityDetails?.data?.data?.applyTime)}
        </Descriptions.Item>
        <Descriptions.Item label={'发布者昵称'}>
          {sceneCommunityDetails?.data?.data?.developerName}
        </Descriptions.Item>
        <Descriptions.Item label={'发布者ID'}>
          {sceneCommunityDetails?.data?.data?.developerId}
        </Descriptions.Item>
      </Descriptions>
    </IAutoPage>
  );
};
export default Index;
